<h1>DefineTextField</h1>

<p>DefineTextField defines an editable text field. The value entered into the text field is assigned to a specified variable allowing the creation of forms to accept values entered by a person viewing the Flash file.</p>

<p>The class contains a complex set of attributes which allows a high degree of control over how a text field is displayed:</p>

<table>

<tr>
<th nowrap>Field Name</th>
<th>Type</th>
<th>Size</th>
<th>Description</th>
</tr>

<tr>
<td nowrap valign="top">type</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">10</td>
<td>Identifies the DefineTextField instruction when it is encoded. It is encoded 
with the length field as a 16-bit integer (Little-endian byte order).</td>
</tr>

<tr>
<td nowrap valign="top">length</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">6</td>
<td>The length in bytes of the body of the instruction when it is encoded. If the length is greater 
than 62 then this field is set to 0x3F and the length is encoded using the 
extendedLength field. Encoded with the type field as a 16-bit integer.</td>
</tr>

<tr>
<td nowrap valign="top">extendedLength</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">32</td>
<td>Optional. Contains the length in bytes of the encoded instruction if it is
greater than 62 bytes. If the length is 62 bytes or less then this field is 
omitted.</td>
</tr>

<tr>
<td nowrap valign="top">identifier</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>A unique number that identifies the definition within the Flash file.</td>
</tr>

<tr>
<td nowrap valign="top">bounds</td>
<td nowrap valign="top">Bounds</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The bounding rectangle for the text field.</td>
</tr>

<tr>
<td nowrap valign="top">hasText</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Is there a default value to be displayed in the field.</td>
</tr>

<tr>
<td nowrap valign="top">isWordWrapped</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Indicates whether the text should be wrapped.</td>
</tr>

<tr>
<td nowrap valign="top">isMultiline</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Indicates whether the text field contains multiple lines.</td>
</tr>

<tr>
<td nowrap valign="top">isPassword</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Indicates whether the text field will be used to display a password.</td>
</tr>

<tr>
<td nowrap valign="top">isReadOnly</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Indicates whether the text field is read only.</td>
</tr>

<tr>
<td nowrap valign="top">hasColour</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Is the colour for the text defined. The default is black.</td>
</tr>

<tr>
<td nowrap valign="top">hasMaxLength</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Is there a maximum number of characters that can be entered into the field.</td>
</tr>

<tr>
<td nowrap valign="top">hasFont</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Is there a font definition specified that will be used to display the text.</td>
</tr>

<tr>
<td nowrap valign="top">reserved</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">1</td>
<td>Reserved</td>
</tr>

<tr>
<td nowrap valign="top">isAutosize</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Indicates whether the text field will resize automatically to fit the text 
entered.</td>
</tr>

<tr>
<td nowrap valign="top">hasLayout</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Does the text field contain information on laying out the text.</td>
</tr>

<tr>
<td nowrap valign="top">isSelectable</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Indicates whether the text field is selectable.</td>
</tr>

<tr>
<td nowrap valign="top">isBordered</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Indicates whether the text field is bordered.</td>
</tr>

<tr>
<td nowrap valign="top">reserved</td>
<td nowrap valign="top">usigned int</td>
<td nowrap valign="top" align="right">1</td>
<td>Reserved.</td>
</tr>

<tr>
<td nowrap valign="top">isHTML</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Indicates whether the text field contains HTML.</td>
</tr>

<tr>
<td nowrap valign="top">useOutlines</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Is the text displayed using a font defined in teh Flash file (1) or using 
a font installed in the Flash Player (0).</td>
</tr>


<tr><td nowrap valign="top">fontIdentifier</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>The identifier of the font displayed in the text field.</td>
</tr>

<tr>
<td nowrap valign="top">height</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>The height of the characters in twips.</td></tr>

<tr>
<td nowrap valign="top">colour</td>
<td nowrap valign="top">Color</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The colour of the text. If set to null then the text color defaults to black.</td>
</tr>

<tr>
<td nowrap valign="top">maxLength</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>The maximum length of the text field. May be set to zero is not maximum length is defined.</td>
</tr>

<tr>
<td nowrap valign="top">variableName</td>
<td nowrap valign="top">String</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The name of the variable the text will be assigned to.</td>
</tr>

<tr>
<td nowrap valign="top">initialText</td>
<td nowrap valign="top">String</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The default text displayed in the text field.</td>
</tr>

</table>

<p>Additional layout information for the spacing of the text relative to the text field borders can also be specified through the following set of attributes:</p>

<table>

<tr>
<td nowrap valign="top">alignment</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">8</td>
<td>Whether the text in the field is left-aligned, right-aligned, centred.</td>
</tr>

<tr>
<td nowrap valign="top">leftMargin</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>Left margin in twips.</td>
</tr>

<tr>
<td nowrap valign="top">rightMargin</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>Right margin in twips.</td>
</tr>

<tr>
<td nowrap valign="top">indent</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>Text indentation in twips.</td>
</tr>

<tr>
<td nowrap valign="top">leading</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>Leading in twips.</td>
</tr>

</table>

<p>The default values for the alignment is AlignLeft while the leftMargin, rightMargin indent and leading attributes are set to zero. If the attributes all set to their default values then the layout information will not be encoded. If any of the values are set to a value other than the default then the values for all of the attributes will be encoded.</p>

<p><b>HTML Support</b><br/>
Setting the HTML flag to true allows text marked up with a limited set of HTML tags to be displayed in the text field. The following tags are supported:</p>

<table>
<tr>
<td nowrap>&lt;p&gt;&lt;/p&gt;</td>
<td>Delimits a paragraph. Only the align attribute is supported:<br><p [align = left | right | center ]></p></td>
</tr>
<tr>
<td nowrap>&lt;br&gt;</td>
<td>Inserts a line break.</p></td>
</tr>
<tr>
<td nowrap>&lt;a&gt;&lt;/a&gt;</td>
<td>Define a hyperlink. Two attributes are supported:<br>
href - the URL of the link.<br>
target - name of a window or frame. (optional)<br>
</td>
</tr>
<tr>
<td nowrap>&lt;font&gt;&lt;/font&gt;</td>
<td>Format enclosed text using the font. Three attributes are supported:<br>
name - must match the name of a font defined using DefineFont2.<br>
size - the height of the font in twips.<br>
color - the colour of the text in the hexadecimal format #RRGGBB.
</td>
</tr>
<tr>
<td nowrap>&lt;b&gt;&lt;/b&gt;</td>
<td>Delimits text that should be displayed in bold.</td>
</tr>
<tr>
<td nowrap>&lt;i&gt;&lt;/i&gt;</td>
<td>Delimits text that should be displayed in italics.</td>
</tr>
<tr>
<td nowrap>&lt;u&gt;&lt;/u&gt;</td>
<td>Delimits text that should be displayed underlined.</td>
</tr>
<tr>
<td nowrap>&lt;li&gt;&lt;/li&gt;</td>
<td>Display bulleted paragraph. Strictly speaking this is not an HTML list. The &lt;ul&gt; tag is not required and no other list format is supported.</td>
</tr>
</table>

<h2>History</h2>

<p>DefineTextField class represents the DefineTextField from the Macromedia Flash 
(SWF) File Format Specification. It was introduced in Flash 4.</p>
